<%-- 
    Document   : login
    Created on : Jan 10, 2013, 4:19:28 PM
    Author     : SONY
--%>

<%@page import="javax.servlet.http.HttpServletRequest"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<p><i style='color:red'>${requestScope.errorMsg}</i></p>
<form method='post' action='<c:url value="/member/login.do" />'>
    <table cellpadding="10px" border="0">
        <tr>
            <td>Email của bạn</td>
<% 
    String email = "";
    String password = "";
    Cookie[] allCookies = ((HttpServletRequest) request).getCookies(); 
    for(int i = 0; i < allCookies.length; i++) {
        if(allCookies[i].getName().equals("email")) {
            email = allCookies[i].getValue();
        }
        if(allCookies[i].getName().equals("password")) {
            password = allCookies[i].getValue();
        }
    }
%>
            <td><input type='text' name='email' size="25" value="<%=email%>"
                       <% if(email.length() == 0) { %>
                            style="background-color: white"
                       <% } else { %>
                            style="background-color: LightYellow"
                       <% } %>
                       ></td>
        </tr>
        <tr>
            <td>Mật Khẩu</td>
            <td><input type='password' name='password' size="25" value="<%=password%>"
                       <% if(password.length() == 0) { %>
                            style="background-color: white"
                       <% } else { %>
                            style="background-color: LightYellow"
                       <% } %>
                       >&nbsp;&nbsp;
            <a href="#">Lấy Lại Mật Khẩu</a></td>           
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>               
                <input type="checkbox" name="remember" value="checked" ${cookie.remember.value}/> Nhớ Tài Khoản               
            </td>
        </tr>
        <tr>
            <td colspan=2 align=center><input type='submit' class="button" name='login' value='Đăng Nhập'></td>
        </tr>
    </table>	
</form>
